- payment_gateway = @listing_presenter.commission[:payment_gateway]
.price-container
  - if @listing_presenter.shape[:price_enabled]
    = form.label :price, t(".price")
    = form.text_field :price, :class => "price-field", :maxlength => "10", :placeholder => "0", :value => (@listing.price ? @listing.price.to_s: 0)
    = render partial: "listings/form/price_currency", locals: {form: form}

    - if @listing_presenter.unit_options.empty?
      -# No-op
    - elsif @listing_presenter.unit_options.length == 1
      - unit_option = @listing_presenter.unit_options.first
      .quantity-description
        = t(".per")
        = unit_option[:display]
      = hidden_field_tag("listing[unit]", unit_option[:value])
    - else
      .quantity-description
        = t(".per")
      %select.js-listing-unit{name: "listing[unit]"}
        - @listing_presenter.unit_options.each do |unit_option|
          %option{value: unit_option[:value], selected: unit_option[:selected], data: { kind: unit_option[:kind] }}
            = unit_option[:display]

    %small
      - payment_fee_info_link = capture do
        %a.listing-payment-fee-info-link#payment_fee_info_link{href: '#'}
          = t(".payment_fee_info_link_text")
      - if @listing_presenter.commission[:seller_commission_in_use]
        - if payment_gateway.present?
          = t(".after_service_fee_you_will_get_payment_text", :sum_with_currency => '<span id="fee_display"></span>', :payment_fee_info_link => payment_fee_info_link).html_safe
        - else
          = t(".after_service_fee_you_will_get", :sum_with_currency => '<span id="fee_display"></span>').html_safe

- if payment_gateway.present?
  = render layout: "layouts/lightbox", locals: { id: "payment_fee_info_content"} do
    %h2= t("common.payment_fee_info.title")

    %p= t("common.payment_fee_info.info")

    - if payment_gateway == :stripe || payment_gateway == [:paypal, :stripe]
      %h4= t("common.payment_fee_info.stripe")
      - text_with_line_breaks_html_safe do
        - link_to_stripe = link_to(t("common.stripe_fee_info.link_to_stripe_text"), @listing_presenter.stripe_fees_url, target: "_blank")
        = t("common.stripe_fee_info.body_text", link_to_stripe: link_to_stripe,
          stripe_commission: @listing_presenter.commission[:stripe_commission],
          minimum_transaction_fee: MoneyViewUtils.to_humanized(@listing_presenter.commission[:stripe_minimum_transaction_fee])).html_safe

    - if payment_gateway == :paypal || payment_gateway == [:paypal, :stripe]
      %h4= t("common.payment_fee_info.paypal")
      - text_with_line_breaks_html_safe do
        - link_to_paypal = link_to(t("common.paypal_fee_info.link_to_paypal_text"), @listing_presenter.paypal_fees_url, target: "_blank")
        = t("common.paypal_fee_info.body_text", link_to_paypal: link_to_paypal,
          paypal_commission: @listing_presenter.commission[:paypal_commission],
          minimum_transaction_fee: MoneyViewUtils.to_humanized(@listing_presenter.commission[:paypal_minimum_transaction_fee])).html_safe


  - if run_js_immediately
    :javascript
      $('#payment_fee_info_link').click(function() { $('#payment_fee_info_content').lightbox_me({centered: true, zIndex: 1000000}); return false});
  - else
    - content_for :extra_javascript do
      :javascript
        $('#payment_fee_info_link').click(function() { $('#payment_fee_info_content').lightbox_me({centered: true, zIndex: 1000000}); ; return false});
